package com.edevp.modules.order.sentinel;

import com.alibaba.csp.sentinel.adapter.spring.webmvc.callback.RequestOriginParser;
import com.alibaba.csp.sentinel.util.StringUtil;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;

/**
 * @author edevp
 */
@Component
public class HeaderOriginParser implements RequestOriginParser {


    @Override
    public String parseOrigin(HttpServletRequest request) {
        String origin = request.getHeader("origin");
        if(StringUtil.isEmpty(origin)){
            origin="blank" ;
        }
        return origin;
    }
}
